package com.example.utils;

import java.util.Random;

/**
 * TODO
 *
 * @author ding
 * @since 2024/7/4
 */
public class SaltUtils {
    public static String getSalt(int n){
        char[] chars = ("1234567890").toCharArray();
        StringBuilder sb = new StringBuilder();
        for(int i = 0; i < n; i++){
            //Random().nextInt()返回值为[0,n)
            char aChar = chars[new Random().nextInt(chars.length)];
            sb.append(aChar);
        }
        return sb.toString();
    }
}

